package com.itheima.chapter07.arrays;

import java.lang.reflect.Array;
import java.util.Arrays;

public class demo {
    public static void main(String[] args) {
        int[] arr ={2,1,4,37,8};
        //输出数组内容
        System.out.println(Arrays.toString(arr));//[2, 1, 4, 37, 8]
        //升序
        Arrays.sort(arr);
        System.out.println(Arrays.toString(arr));//[1, 2, 4, 8, 37]
        int[] arr1={1,2,3,4,5,6,7,8,9,10};
        //输出索引
        int index =Arrays.binarySearch(arr1,4);
        System.out.println(index);
        int index1 =Arrays.binarySearch(arr1,12);
        System.out.println(index1);
    }
}
